﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FlagsEnum
{
    class Program
    {
        //必须是2的冥
        public enum BorderSides { None = 0, Left = 1, Right = 2, Top = 4, Bottom = 8 }
        static void Main(string[] args)
        {
            //按位运算
            BorderSides leftRight = BorderSides.Left | BorderSides.Right;
            if ((leftRight & BorderSides.Left) != 0)
                Console.WriteLine("Includes Left"); // Includes Left
            string formatted = leftRight.ToString(); // "Left, Right"
            BorderSides s = BorderSides.Left;
            s |= BorderSides.Right;
            Console.WriteLine(s == leftRight); // True
            s ^= BorderSides.Right; // Toggles BorderSides.Right
            Console.WriteLine(s); // Left
            Console.Read();
        }
    }
}
